<html>
<head><meta charset="utf-8"><title>Nix build Cargo builds · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Nix.20build.20Cargo.20builds.html">Nix build Cargo builds</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="210615096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Nix%20build%20Cargo%20builds/near/210615096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Finn Behrens <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Nix.20build.20Cargo.20builds.html#210615096">(Sep 19 2020 at 13:24)</a>:</h4>
<p>I got cargo to download things from <a href="http://crates.io">crates.io</a> via nix, which has the advantage (on NixOS) for a system wide cache, which also works for package build for the os. But this is not very fast unfortunately. Has anyone an idea how I can just instruct cargo to give me something like an instruction in json format, which contains rustc calls, and how and where to download the crates?</p>



<a name="210620154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Nix%20build%20Cargo%20builds/near/210620154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Nix.20build.20Cargo.20builds.html#210620154">(Sep 19 2020 at 15:19)</a>:</h4>
<p>There is "build plan" cargo/#5579 but it was always a hack and has lots of bugs and will probably be removed cargo/#7614.</p>



<a name="210622011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Nix%20build%20Cargo%20builds/near/210622011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Finn Behrens <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Nix.20build.20Cargo.20builds.html#210622011">(Sep 19 2020 at 16:02)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120179">Eh2406</span> <a href="#narrow/stream/246057-t-cargo/topic/Nix.20build.20Cargo.20builds/near/210620154">said</a>:</p>
<blockquote>
<p>There is "build plan" cargo/#5579 but it was always a hack and has lots of bugs and will probably be removed cargo/#7614.</p>
</blockquote>
<p>Thanks, but this still seems to require a download of the dependencies. which I would not like cargo to do. What I wanted to archive is that I get a list from cargo with checksums and urls for the crates, and then I return a directory to cargo where every crate source is inside.</p>



<a name="210625390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Nix%20build%20Cargo%20builds/near/210625390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Nix.20build.20Cargo.20builds.html#210625390">(Sep 19 2020 at 17:20)</a>:</h4>
<p>Interesting. Do you care if cargo does the download of its own index?</p>



<a name="210628046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Nix%20build%20Cargo%20builds/near/210628046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Finn Behrens <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Nix.20build.20Cargo.20builds.html#210628046">(Sep 19 2020 at 18:23)</a>:</h4>
<p><span class="user-mention silent" data-user-id="239881">Josh Triplett</span> <a href="#narrow/stream/246057-t-cargo/topic/Nix.20build.20Cargo.20builds/near/210625390">said</a>:</p>
<blockquote>
<p>Interesting. Do you care if cargo does the download of its own index?</p>
</blockquote>
<p>If I have a flag to disable download of the index and only use the cargo.lock then no. I think this is already there with the frozen flag?</p>



<a name="210629425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Nix%20build%20Cargo%20builds/near/210629425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Nix.20build.20Cargo.20builds.html#210629425">(Sep 19 2020 at 18:49)</a>:</h4>
<p>Why not use something like crate2nix?</p>



<a name="210631219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Nix%20build%20Cargo%20builds/near/210631219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Finn Behrens <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Nix.20build.20Cargo.20builds.html#210631219">(Sep 19 2020 at 19:28)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123586">nagisa</span> <a href="#narrow/stream/246057-t-cargo/topic/Nix.20build.20Cargo.20builds/near/210629425">said</a>:</p>
<blockquote>
<p>Why not use something like crate2nix?</p>
</blockquote>
<p>my goal I tried to archive is that I don't have to call anything, which is not nix or cargo, and work in buildRustPackages with recursive nix and then just call cargo to build the things</p>



<a name="210631931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Nix%20build%20Cargo%20builds/near/210631931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Nix.20build.20Cargo.20builds.html#210631931">(Sep 19 2020 at 19:42)</a>:</h4>
<p>I see. I think it would perhaps be more feasible to approach this through import-from-derivation functionality.</p>



<a name="210632000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Nix%20build%20Cargo%20builds/near/210632000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Nix.20build.20Cargo.20builds.html#210632000">(Sep 19 2020 at 19:44)</a>:</h4>
<p>Even if its not specifically crate2nix, <code>cargo metadata</code> should provide you all of the information you need to construct the dependencies etc for nix and the derivations to build the code.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>